//
//  SRModifyPersonalWeightView.m
//  SportRing
//
//  Created by icelee on 14-10-31.
//  Copyright (c) 2014年 HotOne. All rights reserved.
//

#import "SRModifyPersonalWeightView.h"
#import "SRDB.h"

@interface SRModifyPersonalWeightView()


@property(nonatomic, weak)IBOutlet UILabel *showWeightLabel;

@end

@implementation SRModifyPersonalWeightView

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    
}

- (void)setWeightLabelValue:(NSInteger)value
{
    [_showWeightLabel setText:[NSString stringWithFormat:@"%ldkg",(long)value]];
}

- (void)setCurrentWeight:(NSInteger)currentWeight
{
    [self setWeightLabelValue:currentWeight];

    if (_currentWeight == currentWeight) {
        return;
    }
    _currentWeight = currentWeight;
    
    
}

+ (SRModifyPersonalWeightView*)LoadSRModifyPersonalWeightView
{
    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SRModifyPersonalWeightView" owner:self options:nil];
    
    return [nib objectAtIndex:0];
}

-(void)currentValue:(NSInteger)value
{
    _currentWeight = value;
    
    [self setWeightLabelValue:value];

    
}

- (void)didSelectValue:(NSInteger)value
{
    _currentWeight = value;
    
    [[SRMe currentUser] configAttributesWithBlock:^(SRMe *meSelf) {
        meSelf.weight = @(_currentWeight);
    }];
    
    [self setWeightLabelValue:value];

}

@end
